<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>IupWebBrowser</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<style type="text/css">
.style1 {
	text-align: center;
}
.style2 {
	font-size: large;
}
</style>
</head>
<body>
<div id="navigation">
  <ul>
    <li><a href="#Creation">Creation</a></li>
    <li><a href="#Attributes">Attributes</a></li>
    <li><a href="#Callbacks">Callbacks</a></li>
    <li><a href="#Notes">Notes</a></li>
    <li><a href="#Examples">Examples</a></li>
    <li><a href="#SeeAlso">See Also</a></li>
  </ul>
</div>

<h2>IupWebBrowser <span class="style2">[GTK and Windows only] (since 3.3)</span></h2>
<p>Creates a web browser control. It is responsible for managing the drawing of 
the web browser content and forwarding of its events.</p>
<p>In Linux, the implementation uses the 
<a class="http" href="http://webkitgtk.org/" target="_blank">WebKit/GTK+</a>, the new GTK+ port of the
<a class="http" href="http://webkit.org" target="_blank">WebKit</a>, an open-source web content 
engine. More information about WebKit/GTK+ (building, dependencies, releases, 
etc) can be seen in <a href="#Notes">Notes</a> section. When using GTK 2.x it 
uses the WebKit1 API. When using GTK 3.x, in Linux 3.x uses the WebKit1 API, in 
Linux 4.x and newer uses the WebKit2 API.</p>
<p>In Windows, the implementation uses the <strong>IupOleControl</strong> to 
embed an instance of the Internet Explorer WebBrowser control. A listener 
interface is used to capture and handle events using the Active Template Library 
(<a target="_blank" href="http://msdn.microsoft.com/en-us/library/t9adwcde%28v=VS.80%29.aspx">ATL</a>) 
classes. <span id="result_box1" class="" lang="en"><span style="" title="">More information 
about ATL </span></span>can be seen in <a href="#Notes">Notes</a> section. So it 
is only available for Visual C++ compilers when statically linking.</p>
<h3>Initialization and usage</h3>
<p>The <b>IupWebBrowserOpen</b> function must be called after <b>IupOpen</b>. 
  The iupweb.h file must also be included in the source code. The program must be linked to the controls 
  library (iupweb). If static linking is used then in Windows must be linked 
with the &quot;iupole&quot; library and in Linux must be linked with the &quot;webkit-1.0&quot; 
for WebKit1 with GTK2, webkitgtk-3.0 for WebKit1 with GTK3, and webkit2gtk-4.0 + 
gio-2.0 libraries for WebKit2 with GTK3. </p>
<p>To make the control available in Lua use require&quot;iupluaweb&quot; or manually 
call the initialization function in C, 
<b>iupweblua_open</b>, after calling <b>iuplua_open</b>.
  When manually calling the function the iupluaweb.h file must also be included in the source code, 
and the program must be linked to the lua control 
  library (iupluaweb).</p>
<h3><a name="Creation">Creation</a></h3>

<pre>Ihandle* IupWebBrowser(void); [in C]
iup.webbrowser{} -&gt; (<strong>ih</strong>: ihandle) [in Lua]
webbrowser() [in LED]
</pre>
<p>
  <u>Returns:</u> the identifier of the 
  created element, or NULL if an error occurs.</p>
<h3><a name="Attributes">Attributes</a></h3>


<p><strong>BACKCOUNT</strong> [GTK Only] (read only): gets the number of items that precede 
the current page.</p>
<p><strong>BACKFORWARD </strong>(write only): sets the number of steps away from the current 
page and loads the history item. Negative values represent steps backward while 
positive values represent steps forward.</p>
<p><strong>GOBACK </strong>(write only): go to the previous page. Same as BACKFORWARD=-1. 
(since 3.23)</p>
<p><strong>GOFORWARD </strong>(write only): go to the next page. Same as BACKFORWARD=1. 
(since 3.23)</p>
<p><strong>CANGOBACK</strong> (read-only): informs if there is a 
previous page. (since 3.23)</p>
<p><strong>CANGOFORWARD</strong> (read-only): informs if there is a 
next page. (since 3.23)</p>
<p><strong>COPY</strong> (write only): copy the selection to the clipboard. 
(since 3.10)</p>
<p><strong>FORWARDCOUNT</strong> [GTK Only] (read only): gets the number of items that 
succeed the current page.</p>
<p><strong>HTML</strong>: loads a given HTML content. (not write only since 
3.30)</p>
<p><strong>ITEMHISTORYid</strong> [GTK Only] (read only): Returns the URL 
associated with a specific history item. Negative &quot;id&quot; value represents a backward item while positive &quot;id&quot; 
value represents a forward item (&quot;0&quot; represents the current item).</p>
<p><strong>INNERTEXT</strong> [Windows Only]: the innerText property of the HTML 
element marked with the ID given by the attribute ELEMENT_ID. (since 3.24)</p>
<p><strong>ATTRIBUTE</strong> [Windows Only]: the content attribute of the HTML 
element marked with the ID given by the attribute ELEMENT_ID. The name of the 
content attribute is given by the attribute ATTRIBUTE_NAME. (since 3.24)</p>
<p><strong>PRINT </strong>(write only): shows the print dialog. In Windows if 
set to Yes will display the system print dialog (since 3.30). (since 3.10)</p>
<p><strong>PRINTPREVIEW</strong> [Windows Only]: shows a print preview dialog. 
(since 3.30)</p>
<p><strong>RELOAD</strong> (write only): reloads the page in the webbrowser.</p>
<p><strong>SELECTALL</strong> (write only): selects all contents. (since 3.10)</p>
<p><strong>STATUS</strong> (read only): returns the load status. Can be 
&quot;LOADING&quot;, &quot;COMPLETED&quot; or &quot;FAILED&quot;.</p>
<p><strong>STOP </strong>(write only): stops any ongoing load in the webbrowser.</p>


<p><strong>VALUE</strong>: sets a specified URL to load into the webbrowser, or 
retrieve the current URL.</p>
<p><strong>ZOOM</strong>: the zoom factor of the browser in percent. No zoom is 
100%. (since 3.10)</p>
<hr>
<p><strong>EDITABLE</strong>: enable the design mode, or the
<span style="color: rgba(0, 0, 0, 0.87); font-family: arial, sans-serif-light, sans-serif; font-size: 30px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">
WYSIWYG HTML editor. Can be Yes or NO. </span>(since 3.30)</p>
<p class="style1">(All the following attributes depends on the EDITABLE 
attribute)</p>
<p><strong>NEW</strong> (write-only): initializes blank document. Value is 
ignored.</p>
<p><strong>OPENFILE</strong> (write-only): open an HTML file given its filename. 
In Windows if the file is modified it will ask for a confirmation.</p>
<p><strong>SAVEFILE</strong> (write-only): save the contents in a HTML file 
given its filename. In Linux will save in a .mhtml file with all the images 
packed in a single file. </p>
<p><strong>DIRTY</strong> [Windows Only]: Returns Yes or No if the contents has 
been edited by the user.</p>
<p><strong>UNDO</strong> (write-only): undo the last editing.</p>
<p><strong>REDO</strong> (write-only): redo the last editing.</p>
<p><strong>CUT</strong> (write-only): cuts the selection to the clipboard.</p>
<p><strong>PASTE</strong> (write-only): pastes the clipboard to the selection or 
caret.</p>
<p><strong>SELECTALL</strong> (write-only): selects all the contents.</p>
<p><strong>FIND</strong> [Windows Only] (write-only): shows a dialog for finding 
a text.</p>
<p><strong>EXECCOMMAND</strong> (write-only): executes an editing command. 
Possible commands:&nbsp; CUT, COPY, PASTE, UNDO, REDO, SELECTALL, BOLD, ITALIC, 
UNDERLINE, STRIKETHROUGH, JUSTIFYLEFT, JUSTIFYCENTER, JUSTIFYRIGHT, JUSTIFYFULL, 
INDENT, OUTDENT, REMOVEFORMAT, DELETE, SUBSCRIPT, SUPERSCRIPT, 
INSERTORDEREDLIST, INSERTUNORDEREDLIST, UNLINK.</p>
<p><strong>COMMANDSTATE</strong> [Windows Only] (read-only): returns the command 
state. Can be Yes or No. The command name must be stored on the attribute 
COMMAND.&nbsp; </p>
<p><strong>COMMANDENABLED</strong> [Windows Only] (read-only): returns if the 
command is enabled. Can be Yes or No. The command name must be stored on the 
attribute COMMAND.</p>
<p><strong>COMMANDTEXT</strong> [Windows Only] (read-only): returns the command 
text if any. The command name must be stored on the attribute COMMAND.</p>
<p><strong>COMMANDVALUE</strong> [Windows Only] (read-only): returns the command 
value if any. The command name must be stored on the attribute COMMAND.</p>
<p><strong>INSERTIMAGE</strong> (write-only): inserts an image given its url. In 
Windows if value is NULL displays a system dialog for inserting an image.</p>
<p><strong>INSERTIMAGEFILE</strong> (write-only): inserts an image given its 
filename.</p>
<p><strong>CREATELINK</strong> (write-only): inserts a link given its url. In 
Windows if value is NULL displays a system dialog for editing a link.</p>
<p><strong>INSERTTEXT</strong> (write-only): inserts a text at the current 
selection or caret.</p>
<p><strong>INSERTHTML</strong> (write-only): inserts a formatted text at the 
current selection or caret.</p>
<p><strong>FONTNAME</strong>: font face name. In Linux is write-only.</p>
<p><strong>FONTSIZE</strong>: font relative size. In Linux is write-only. Can be 
a number form &quot;1&quot; to &quot;7&quot;, meaning 1: x-small, 2: small, 3: medium, 4: large, 5: 
x-large, 6: xx-large, 7: xxx-large.</p>
<p><strong>FORMATBLOCK</strong>: The block format. In Linux is write-only. It 
can be: &quot;Heading 1&quot;, &quot;Heading 2&quot;, &quot;Heading 3&quot;, &quot;Heading 4&quot;, &quot;Heading 5&quot;, 
&quot;Heading 6&quot;, &quot;Paragraph&quot;, &quot;Preformatted&quot; and &quot;Block Quote&quot;. In Windows returns 
&quot;Normal&quot; for &quot;Paragraph&quot;,&nbsp; &quot;Formatted&quot; for &quot;Preformatted&quot; and &quot;Block Quote&quot; 
is not supported. </p>
<p><strong>FORECOLOR</strong>: the foreground color of the selected text. In 
Linux is write-only.</p>
<p><strong>BACKCOLOR</strong>: the background color of the selected text. In 
Linux is write-only.</p>
  <blockquote>
  <hr>
</blockquote>
<p>
<a href="../attrib/iup_active.html">ACTIVE</a>,
<a href="../attrib/iup_font.html">FONT</a>, 
    <a href="../attrib/iup_expand.html">EXPAND</a>, <a href="../attrib/iup_screenposition.html">SCREENPOSITION</a>, 
<a href="../attrib/iup_position.html">
POSITION</a>, <a href="../attrib/iup_minsize.html">
MINSIZE</a>, <a href="../attrib/iup_maxsize.html">
MAXSIZE</a>,
    <a href="../attrib/iup_wid.html">WID</a>, <a href="../attrib/iup_tip.html">TIP</a>, 
<a href="../attrib/iup_rastersize.html">RASTERSIZE</a>,
    <a href="../attrib/iup_zorder.html">ZORDER</a>, <a href="../attrib/iup_visible.html">VISIBLE</a>: 
also accepted.</p>
<h3><a name="Callbacks">Callbacks</a></h3>

<p><strong>COMPLETED_CB</strong><tt>:</tt> action generated when a page 
successfully completed. <span>Can be called multiple times when a frame set 
loads its frames, or when a page loads also other pages.</span></p>
<pre>int function(Ihandle* <b>ih</b>, char* <b>url</b>);  [in C]<strong>
ih</strong>:completed_cb(<b>url</b>) -&gt; (<strong>ret</strong>: number) [in Lua]</pre>
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.<br>
    <strong>url</strong>: the URL address that completed.</p>

<p><strong>ERROR_CB</strong><tt>:</tt> action generated when page load fail.</p>
<pre>int function(Ihandle* <b>ih</b>, char* <b>url</b>);  [in C]<strong>
ih</strong>:error_cb(<b>url</b>) -&gt; (<strong>ret</strong>: number) [in Lua]</pre>
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.<br>
    <strong>url</strong>: the URL address that caused the error.</p>

<p><strong>NAVIGATE_CB</strong><tt>:</tt> action generated when the browser 
requests a navigation to another page. It is called before navigation occurs<span>. 
Can be called multiple times when a frame set loads its frames, or when a page 
loads also other pages.</span></p>
<pre>int function(Ihandle* <b>ih</b>, char* <b>url</b>);  [in C]<strong>
ih</strong>:navigate_cb(<b>url</b>) -&gt; (<strong>ret</strong>: number) [in Lua]</pre>
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.<br>
<strong>url</strong>: the URL address to navigate to.</p>

<p class="info"><u>Returns</u>: IUP_IGNORE will abort navigation (since 3.4).</p>

<p><strong>NEWWINDOW_CB</strong><tt>:</tt> action generated when the browser 
requests a new window.</p>
<pre>int function(Ihandle* <b>ih</b>, char* <b>url</b>);  [in C]<strong>
ih</strong>:newwindow_cb(<b>url</b>) -&gt; (<strong>ret</strong>: number) [in Lua]</pre>
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.<br>
    <strong>url</strong>: the URL address that is opened in the new window.</p>
<blockquote>

<p><strong>UPDATE_CB</strong> [Windows Only]: action generated when the selection was 
changed and the editor interface needs an update. Used only when EDITABLE=Yes. 
(since 3.30)</p>
<pre>int function(Ihandle* <b>ih</b>);  [in C]<strong>
ih</strong>:update_cb() -&gt; (<strong>ret</strong>: number) [in Lua]</pre>
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.</p>
  <hr>
</blockquote>

<p class="info"> 
<a href="../call/iup_map_cb.html">MAP_CB</a>, 
<a href="../call/iup_unmap_cb.html">UNMAP_CB</a>, 
<a href="../call/iup_destroy_cb.html">DESTROY_CB</a>: callbacks are 
supported.</p>
<h3><a name="Notes">Notes</a></h3>
<p>To learn more about WebKit and WebKitGTK+:</p>
<p class="info">
<a target="_blank" href="http://webkit.org/">The WebKit Open Source Project</a><br>
<a target="_blank" href="http://webkitgtk.org/">The WebKitGTK+ web page</a><br>
<a target="_blank" href="http://live.gnome.org/WebKitGtk">WebKitGTK+ wiki</a><br>
<a target="_blank" href="http://trac.webkit.org/wiki/WebKitGTK">WebKitGTK+ tracker</a></p>
<p>To learn more about Internet Explorer WebBrowser control and ATL:</p>
<p class="info">
<a target="_blank" href="http://msdn.microsoft.com/en-us/library/aa752044%28VS.85%29.aspx">WebBrowser Control from C/C++</a><br>
<a target="_blank" href="http://support.microsoft.com/kb/194179/en-us/">Creating ATL sinks</a><br>
<a target="_blank" href="http://homepage.eircom.net/~codexpert/sink/">Examples of sinking COM events</a></p>
<h3><a name="Examples">Examples</a></h3>
<p><a href="../../examples/">Browse for Example Files</a></p>

<p class="style1">
<img src="images/iupwebbrowser.png"></p>

</body>

</html>

